Skip to content

Fix handling of deleted TreeNodes #24345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 15, 2025

Conversation

CraigMacomber
Copy link
Contributor

Description

Fix invalid caching of TreeNodes across view disposal.

Fix asserts instead of usage errors when accessing disposed nodes.

Make errors more robust by centralizing error logic in node kernel's lookup.

Add some additional validation internally.

Clarify docs on TreeNodeStatus.Deleted

Reviewer Guidance

The review process is outlined on this wiki page.

@Copilot Copilot AI review requested due to automatic review settings April 11, 2025 23:17
@CraigMacomber CraigMacomber requested a review from a team as a code owner April 11, 2025 23:17
@github-actions github-actions bot added base: main PRs targeted against main branch area: dds Issues related to distributed data structures area: dds: tree labels Apr 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

packages/dds/tree/src/shared-tree/checkoutFlexTreeView.ts:73

  • [nitpick] Consider using a more descriptive error message (e.g., 'View has already been disposed') to improve debugging clarity.
assert(!this.disposed, "disposed");

@CraigMacomber CraigMacomber requested a review from a team as a code owner April 14, 2025 18:23
Copy link
Contributor

@alexvy86 alexvy86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of docs fixes/suggestions but otherwise approving for docs.

CraigMacomber and others added 2 commits April 15, 2025 13:49
Co-authored-by: Alex Villarreal <716334+alexvy86@users.noreply.github.com>
Copy link
Contributor

@alexvy86 alexvy86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for docs

// Calling this is a performance improvement, however, do this only after demand to avoid momentarily having no anchors to anchorNode
anchorForgetters?.get(this.node)?.();
if (!allowDeleted) {
assertFlexTreeEntityNotFreed(this.#hydrationState.innerNode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: unrelated to this PR, but should this function be renamed to assertFlexTreeEntityNotDeleted? The doc comment for the function also seems to say Assert entity is not deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the flex tree abstraction, we have isFreed which this is referring to, so I think its fine. Probably would be nice to better along the terminology in the two layers though.

@CraigMacomber CraigMacomber merged commit 0ab3e51 into microsoft:main Apr 15, 2025
40 checks passed
@CraigMacomber CraigMacomber deleted the CleanupNodes branch April 15, 2025 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree area: dds Issues related to distributed data structures base: main PRs targeted against main branch changeset-present
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants